package itheima.d07;

import java.time.LocalDate;
import java.util.ArrayList;

//获取近一个月的日期数据。存储到日期集合中
public class Test4 {
    public static void main(String[] args) {
        //获取近一个月的 日期
        LocalDate now = LocalDate.now();
        LocalDate beforeNow = now.plusMonths(-1);
        System.out.println(now);
        System.out.println(beforeNow);

        //存储到日期集合中
        ArrayList<LocalDate> dates = new ArrayList<>();
        dates.add(beforeNow);

        while (beforeNow.isBefore(now)){
            beforeNow = beforeNow.plusDays(1);
            dates.add(beforeNow);
        }

        for (LocalDate date : dates) {
            System.out.println(date);
        }


        System.out.println("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
        ArrayList<LocalDate> list=new ArrayList<>();
        for (int i = 0; i < 30; i++) {
            list.add(now.plusDays( -i));
            System.out.println(list);

        }


    }
}
